package com.transfiguro.datamodel.javamodels;

import com.transfiguro.datamodel.Statement;

import java.util.ArrayList;
import java.util.List;

/**
 * This class defines a method. Whenever a method is encountered, an instance of {@link Method} will be created
 */
public class Method {
    private String methodName;
    private int accessModifier;
    private String returnType;
    private List<Variable> inputParameters;
    private String methodBody;
    private List<Statement> statements;
    private JavaDoc comment;

    public Method() {
        statements = new ArrayList<Statement>();
    }

    public void addStatement(final Statement statement) {
        statements.add(statement);
    }
    
    public String getMethodName() {
        return methodName;
    }

    public void setMethodName(final String methodName) {
        this.methodName = methodName;
    }

    public int getAccessModifier() {
        return accessModifier;
    }

    public void setAccessModifier(final int accessModifier) {
        this.accessModifier = accessModifier;
    }

    public String getReturnType() {
        return returnType;
    }

    public void setReturnType(final String returnType) {
        this.returnType = returnType;
    }

    public List<Variable> getInputParameters() {
        if(inputParameters == null) {
            inputParameters = new ArrayList<Variable>();
        }
        return inputParameters;
    }

    public void setInputParameters(final List<Variable> inputParameters) {
        this.inputParameters = inputParameters;
    }

    public String getMethodBody() {
        return methodBody;
    }

    public void setMethodBody(final String methodBody) {
        this.methodBody = methodBody;
    }

    public JavaDoc getComment() {
        return comment;
    }

    public void setComment(final JavaDoc comment) {
        this.comment = comment;
    }

    public List<Statement> getStatements() {
        if(statements == null) {
            statements = new ArrayList<Statement>();
        }
        return statements;
    }

    public void setStatements(final List<Statement> statements) {
        this.statements = statements;
    }
}
